<?php

namespace App\Http\Controllers\API;

use App\Repositories\ArticleRepository;
use App\ZL\Controllers\ApiBaseController;
use Illuminate\Http\Request;
use App\Http\Controllers\AppBaseController;
use InfyOm\Generator\Criteria\LimitOffsetCriteria;
use Prettus\Repository\Criteria\RequestCriteria;
use Response;

/**
 * Class ContainerController
 * @package App\Http\Controllers\API
 */

class NewDevelopmentsAPIController extends ApiBaseController
{
    private $article;
    protected $model_name = 'App\Models\NewDevelopment';
    protected $model_load_array = [
    ];
    protected $search_field_array = [
        'new_development_type_id'
    ];

    public function __construct()
    {
    }


    protected function modelGetSort(&$model)
    {
        $sortBy = request('sortBy','id');
        $orderBy = request('orderBy','desc');

        $model = $model->when($sortBy, function ($query) use ($sortBy,$orderBy){
            return $query->orderBy($sortBy,$orderBy);
        }, function ($query) use ($orderBy){
            return $query->orderBy('id',$orderBy);
        });
        return $model;
    }
}
